package com.example.vlille2.base;

import android.location.Location;
import android.util.Log;

public class Station{
	
	private int id,statut,velos,places;

	private String nom,adresse;
	private boolean estFavoris,compatibleCB;
	private double lattitude,longitude;
	private float distanceUtilisateur;
		
	public Station(int id, int statut, int velos, int places, String nom,
			String adresse, boolean paiement, boolean estFavoris,
			double lattitude, double longitude) {
		super();
		this.id = id;
		this.statut = statut;
		this.velos = velos;
		this.places = places;
		this.nom = nom;
		this.adresse = adresse;
		this.compatibleCB = paiement;
		this.estFavoris = estFavoris;
		this.lattitude = lattitude;
		this.longitude = longitude;
	}
	
	public int getId() {
		return id;
	}
	public boolean isEnLigne() {
		return statut == 0;
		//return statut == 1;
	}
	public int getVelos() {
		return velos;
	}
	public int getPlaces() {
		return places;
	}
	public String getNom() {
		return nom;
	}
	public String getAdresse() {
		return adresse;
	}
	public boolean isCompatibleCB() {
		return compatibleCB;
	}
	public boolean isFavoris() {
		return estFavoris;
	}
	public double getLattitude() {
		return lattitude;
	}
	public double getLongitude() {
		return longitude;
	}

	public String toString()
	{
		return "{\nID: "+id
				+"\nNom: "+nom
				+"\nAdresse: "+adresse
				+"\nStatut: "+statut
				+"\nFavoris: "+estFavoris
				+"\nCompatible CB: "+compatibleCB
				+"\nVelos: "+velos
				+"\nPlaces: "+places
				+"\nCoords: "+lattitude+","+longitude+"\n}";
	}
	
	public float getDistanceUtilisateur() {
		return distanceUtilisateur;
	}

	public void setDistanceUtilisateur(float distanceUtilisateur) {
		this.distanceUtilisateur = distanceUtilisateur;
	}

	public float calculerDistanceA(Location userLocation)
	{
		if(userLocation == null){
			setDistanceUtilisateur(0);
			return getDistanceUtilisateur();
		} else {
			Location loc_station = new Location("GPS");
			loc_station.setLatitude(getLattitude());
			loc_station.setLongitude(getLongitude());
			float distance = userLocation.distanceTo(loc_station);
			setDistanceUtilisateur(distance);
			return getDistanceUtilisateur();
		}	
	}
	
	public boolean isEstFavoris() {
		return estFavoris;
	}

	public void setEstFavoris(boolean estFavoris) {
		this.estFavoris = estFavoris;
	}

	public void setStatut(int statut) {
		this.statut = statut;
	}

	public void setVelos(int velos) {
		this.velos = velos;
	}

	public void setPlaces(int places) {
		this.places = places;
	}

	public void setNom(String nom) {
		this.nom = nom;
	}

	public void setAdresse(String adresse) {
		this.adresse = adresse;
	}

	public void setCompatibleCB(boolean compatibleCB) {
		this.compatibleCB = compatibleCB;
	}

	public void setLattitude(double lattitude) {
		this.lattitude = lattitude;
	}

	public void setLongitude(double longitude) {
		this.longitude = longitude;
	}

	public void setId(int id) {
		this.id = id;
	}	
}
